/*
 *-------------------------------------------------------------
 *    copyrights by
 *    	Bartosz "Dust" Kowalski (dustization.info) 
 *-------------------------------------------------------------
 *    Plik: 	PCMSettings.java
 *    Data:		16-12-2011
 *    
 */

package core;

import java.io.Serializable;

/**
 * 		<p><b>PCMSettings</b> - </p> 
 * 		<p></p> 
 * 
 * 		@author  <br><b>Bartosz 'Dust' Kowalski</b>
 */
class PCMSettings implements Serializable
{
	public static final PCMSettings PCM_MODULATION_SETTINGS = 
			new PCMSettings(PCMView.ACTION_MODULATION, PCMView.ALGORITHM_PCM);
	public static final PCMSettings PCM_DEMODULATION_SETTINGS = 
		new PCMSettings(PCMView.ACTION_DEMODULATION, 	PCMView.ALGORITHM_PCM);
	public static final PCMSettings DPCM_MODULATION_SETTINGS = 
		new PCMSettings(PCMView.ACTION_MODULATION, 	PCMView.ALGORITHM_DPCM);
	public static final PCMSettings DPCM_DEMODULATION_SETTINGS = 
		new PCMSettings(PCMView.ACTION_DEMODULATION, 	PCMView.ALGORITHM_DPCM);
	
	private String	currentAction;
	private String	currentAlg;
	private double	sampleRate;
	private int		resolution;
	
	
	public PCMSettings()
	{
		super();
	}
	
	/**
	 * @param currentAction
	 * @param currentAlg
	 */
	private PCMSettings(String currentAction, String currentAlg)
	{
		super();
		this.currentAction = currentAction;
		this.currentAlg = currentAlg;
	}

	/**
	 * @return the currentAction
	 */
	public String getCurrentAction()
	{
		return currentAction;
	}

	/**
	 * @param currentAction the currentAction to set
	 */
	public void setCurrentAction(String currentAction)
	{
		this.currentAction = currentAction;
	}

	/**
	 * @return the currentAlg
	 */
	public String getCurrentAlg()
	{
		return currentAlg;
	}

	/**
	 * @param currentAlg the currentAlg to set
	 */
	public void setCurrentAlg(String currentAlg)
	{
		this.currentAlg = currentAlg;
	}

	/**
	 * @return the sampleRate
	 */
	public double getSampleRate()
	{
		return sampleRate;
	}

	/**
	 * @param sampleRate the sampleRate to set
	 */
	public void setSampleRate(double sampleRate)
	{
		this.sampleRate = sampleRate;
	}

	/**
	 * @return the resolution
	 */
	public int getResolution()
	{
		return resolution;
	}
	
	/**
	 * @param resolution the resolution to set
	 */
	public void setResolution(int resolution)
	{
		this.resolution = resolution;
	}

	/**
	 * 		@see java.lang.Object#toString()
	 */
	@Override
	public String toString()
	{
		return String
				.format("PCMSettings [currentAction=%s, currentAlg=%s, sampleRate=%s, resolution=%s]",
						currentAction, currentAlg, sampleRate, resolution);
	}

	/**
	 * 		@see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((currentAction == null) ? 0 : currentAction.hashCode());
		result = prime * result
				+ ((currentAlg == null) ? 0 : currentAlg.hashCode());
		return result;
	}

	/**
	 * 		@see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}
		if (obj == null)
		{
			return false;
		}
		if (!(obj instanceof PCMSettings))
		{
			return false;
		}
		PCMSettings other = (PCMSettings) obj;
		if (currentAction == null)
		{
			if (other.currentAction != null)
			{
				return false;
			}
		} else if (!currentAction.equals(other.currentAction))
		{
			return false;
		}
		if (currentAlg == null)
		{
			if (other.currentAlg != null)
			{
				return false;
			}
		} else if (!currentAlg.equals(other.currentAlg))
		{
			return false;
		}
		return true;
	}
}
